package com.makinolo.rlvforge.tacx.data
{
//import com.makinolo.tacxtools.utils.StringUtils;
import flash.utils.ByteArray;
import com.makinolo.rlvforge.tacx.utils.StringUtils;

public class RLVInfo implements Persistent
{
	public static const RECORD_SIZE:int = 534;
	private static const TEXT_LEN:int = 260;
	
	private var VideoFileName:String;//	Location of the RLV AVI file
	private var FrameRate:Number; 	 // Video frame rate in fps
	private var OrgRunWeight:Number;
	private var FrameOffset:int;
	
/*	public function RLVInfo(LEDataInputStream dis) 
	{
		VideoFileName = dis.readString(TEXT_LEN); 		
		FrameRate = dis.readNumber();
		OrgRunWeight = dis.readNumber();
		FrameOffset = dis.readInt();
	}
	*/
	public function RLVInfo(videoFileName:String, frameRate:Number, orgRunWeight:Number, frameOffset:int)
	{
		super();
		this.setVideoFileName(videoFileName);
		FrameRate = frameRate;
		OrgRunWeight = orgRunWeight;
		FrameOffset = frameOffset;
	}
	
	public function getFrameOffset():int
	{
		return FrameOffset;
	}
	public function setFrameOffset(frameOffset:int):void
	{
		FrameOffset = frameOffset;
	}
	public function getFrameRate():Number
	{
		return FrameRate;
	}
	public function setFrameRate(frameRate:Number):void
	{
		FrameRate = frameRate;
	}
	public function getOrgRunWeight():Number
	{
		return OrgRunWeight;
	}
	public function setOrgRunWeight(orgRunWeight:Number):void
	{
		OrgRunWeight = orgRunWeight;
	}
	public function getVideoFileName():String
	{
		return VideoFileName;
	}
	public function setVideoFileName(videoFileName:String):void
	{
		VideoFileName = StringUtils.stuff(videoFileName, 0,TEXT_LEN);
	}

	public function persist(dos:ByteArray):void
	{
		dos.writeBytes(StringUtils.StringToTacxBytes(VideoFileName)); 
		dos.writeFloat(FrameRate);
		dos.writeFloat(OrgRunWeight);
		dos.writeInt(FrameOffset);		
	}
	
	
}

}